package net.lab1024.sa.admin.module.business.exam.controller;

import net.lab1024.sa.admin.module.business.exam.domain.form.add.CoursebAddForm;
import net.lab1024.sa.admin.module.business.exam.domain.form.query.CoursebQueryForm;
import net.lab1024.sa.admin.module.business.exam.domain.form.update.CoursebUpdateForm;
import net.lab1024.sa.admin.module.business.exam.domain.vo.CoursebVO;
import net.lab1024.sa.admin.module.business.exam.service.CoursebService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import cn.dev33.satoken.annotation.SaCheckPermission;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * 生产订单与机器对应表 Controller
 *
 * @Author AKITA
 * @Date 2025-05-22 15:32:44
 * @Copyright AKITA
 */

@RestController
@Tag(name = "生产订单与机器对应表")
public class CoursebController {

    @Resource
    private CoursebService coursebService;

    @PostMapping("/courseb/queryPage")
    public ResponseDTO<PageResult<CoursebVO>> queryPage(@RequestBody @Valid CoursebQueryForm queryForm) {
        return ResponseDTO.ok(coursebService.queryPage(queryForm));
    }


    @PostMapping("/courseb/add")
    public ResponseDTO<String> add(@RequestBody @Valid CoursebAddForm addForm) {
        return coursebService.add(addForm);
    }

    @PostMapping("/courseb/batchadd/{docEntry}")
    public ResponseDTO<String> batchAdd(@PathVariable Long docEntry,@RequestBody List<Long> addForms) {
        return coursebService.batchAdd(addForms,docEntry);
    }

    @PostMapping("/courseb/update")

    public ResponseDTO<String> update(@RequestBody @Valid CoursebUpdateForm updateForm) {
        return coursebService.update(updateForm);
    }


    @PostMapping("/courseb/batchDelete")

    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return coursebService.batchDelete(idList);
    }


    @GetMapping("/courseb/delete/{docEntry}")

    public ResponseDTO<String> batchDelete(@PathVariable Long docEntry) {
        return coursebService.delete(docEntry);
    }
}
